# include <bits/stdc++.h>
using namespace std;
int a[11], n, f[102];
int main() {
    freopen("busa.in", "r", stdin);
    freopen("busa.out", "w", stdout);
    memset(f, 127 >> 1, sizeof(f));
    f[0] = 0;
    for(int i = 1; i <= 10; i++) cin >> a[i];
    cin >> n;
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= min(10, i); j++)
            f[i] = min(f[i], f[i - j] + a[j]);
    printf("%d\n", f[n]);
}